package com.shbaiche.bifenba.ui.my;

import android.Manifest;
import android.annotation.TargetApi;
import android.app.NotificationManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.meiqia.meiqiasdk.activity.MQConversationActivity;
import com.meiqia.meiqiasdk.model.Agent;
import com.meiqia.meiqiasdk.model.BaseMessage;
import com.meiqia.meiqiasdk.model.TextMessage;
import com.meiqia.meiqiasdk.util.MQUtils;

/**
 * 集成自 MQConversationActivity，可以动态改变其中的一些方法实现
 */
public class CustomizedMQConversationActivity extends MQConversationActivity {
    private static final int WRITE_EXTERNAL_STORAGE_REQUEST_CODE = 1;
    private TextView tvTitle;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 这里可以动态添加一些 View 到布局中
        // eg: 右边添加一个按钮
        tvTitle =  (TextView) findViewById(com.meiqia.meiqiasdk.R.id.title_tv);

        NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        if(mNotificationManager!=null){
            mNotificationManager.cancel(55678);
        }
    }



    @Override
    protected void onLoadDataComplete(MQConversationActivity mqConversationActivity, Agent agent) {
        if (agent != null) {
            //BaseMessage message = new TextMessage("这是一条自动发送的消息");
            // 在打开对话界面的时候，自动发送一条消息
            //mqConversationActivity.sendMessage(message);
        }else{
           tvTitle.setText("在线客服");
        }
    }

}
